package mixins

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/mixin"
	"gitlab.zhijiasoft.com/paperless-group/saas-common/utils/sonyflake"
)

type SnowflakeMixin struct {
	mixin.Schema
}

func (SnowflakeMixin) Fields() []ent.Field {
	return []ent.Field{
		field.String("id").DefaultFunc(sonyflake.GetStringFlake).Comment("Snowflake ID | 全局唯一ID"),
	}
}

func (SnowflakeMixin) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
	}
}
